{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "df08f006",
   "metadata": {},
   "source": [
    "# hashlib\n",
    "1. result of hashlib.md5() is a 128 bits code\n",
    "2. which contains 16 hexadecimal number (x256)\n",
    "3. digest() | hexdigest()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f8988b4b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "b'L\\x82<\\x95\\x18\\x93\\x811r\\xb0\\xb5bq\\xde\\xa7\\xf7'\n",
      "4c823c951893813172b0b56271dea7f7\n",
      "247\n",
      "0xf7\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import hashlib\n",
    "\n",
    "hex_res = hashlib.md5(np.int64(2334)).digest()\n",
    "print(hex_res)\n",
    "hex_deco = hex_res.hex()\n",
    "print(hex_deco)\n",
    "print(hashlib.md5(np.int64(2334)).digest()[-1])\n",
    "print(hex(hashlib.md5(np.int64(2334)).digest()[-1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6468c35a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "number:  1 value:  4c\n",
      "number:  2 value:  82\n",
      "number:  3 value:  3c\n",
      "number:  4 value:  95\n",
      "number:  5 value:  18\n",
      "number:  6 value:  93\n",
      "number:  7 value:  81\n",
      "number:  8 value:  31\n",
      "number:  9 value:  72\n",
      "number:  10 value:  b0\n",
      "number:  11 value:  b5\n",
      "number:  12 value:  62\n",
      "number:  13 value:  71\n",
      "number:  14 value:  de\n",
      "number:  15 value:  a7\n",
      "number:  16 value:  f7\n"
     ]
    }
   ],
   "source": [
    "l = list(hashlib.md5(np.int64(2334)).hexdigest())\n",
    "counter = 0\n",
    "for index, i in enumerate(l):\n",
    "    if(index % 2 == 1):\n",
    "        counter += 1  \n",
    "        hex_num = l[index-1] + l[index]\n",
    "        print(\"number: \", counter, \"value: \", hex_num)\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "71560b8a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "python3.6",
   "language": "python",
   "name": "python3.6"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
